package xyz.yeidi.service.impl;

import xyz.yeidi.dao.api.OrderDetailDao;
import xyz.yeidi.dao.impl.OrderDetailDaoImpl;
import xyz.yeidi.pojo.Food;
import xyz.yeidi.pojo.Orderdetail;
import xyz.yeidi.service.api.OrderDetailService;
import xyz.yeidi.utils.ConnUtils;
import xyz.yeidi.utils.ServiceFactory;

import java.util.List;

/**
 * @Author JIP
 * @Date 2021-08-08 11:01
 * @Version 1.0
 * @Describe :
 */
public class OrderDetailServiceImpl implements OrderDetailService {
    OrderDetailDao orderDetailDao = new OrderDetailDaoImpl();
    @Override
    public Integer addOrderDetail(Orderdetail orderdetail) {
        try {
            return orderDetailDao.addOrderDetail(orderdetail);
        } catch (Exception e) {
            e.printStackTrace();
        }finally {
            ConnUtils.close();
        }
        return null;
    }

    @Override
    public List<Food> getFoodsByOrderId(Integer orderId) {
        try {
            return orderDetailDao.getFoodsByOrderId(orderId);
        } catch (Exception e) {
            e.printStackTrace();
        }finally {
            ConnUtils.close();
        }
        return null;
    }
}
